package com.syg.listener3;

import com.syg.event.MyEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;

/**
 * 方式3 需要在application.properties中配置监听
 *
 */
public class MyListener3 implements ApplicationListener<MyEvent> {
    Logger log = LoggerFactory.getLogger(MyListener3.class);

    @Override
    public void onApplicationEvent(MyEvent event) {
        log.info(String.format("%s监听到事件源：%s.", MyListener3.class.getName(), event.getSource()));
    }
}
